home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '89 / Other stuff / MacSTILE / Sample Projects / Concurrent Enhancements next >
Encoding:
Text File  |  1989-01-06  |  10.6 KB  |  1,676 lines  |  [TEXT/STIL]

  1. 100
  2. 30
  3. 60
  4. 200
  5. 400
  6. 40
  7. 2
  8. 4
  9. 9
  10. 22
  11. 0
  12. 12
  13. Control Port
  14. 2
  15. 2
  16. 0
  17. 0
  18. 17
  19. 3
  20. 43
  21. 0
  22. 1
  23. 9
  24. Data Port
  25. 2
  26. 2
  27. 0
  28. 0
  29. 17
  30. 0
  31. 33
  32. 0
  33. 2
  34. 12
  35. Control Link
  36. 1
  37. 2
  38. 0
  39. 2
  40. 0
  41. 0
  42. 2
  43. 0
  44.  
  45. 0
  46.  
  47. 0
  48. 1
  49. 0
  50. 1
  51. 0
  52. 2
  53. 0
  54.  
  55. 0
  56.  
  57. 1
  58. 0
  59. 0
  60. 17
  61. 2
  62. 0
  63. 1
  64. 1
  65. 3
  66. 9
  67. Data Link
  68. 1
  69. 2
  70. 0
  71. 2
  72. 0
  73. 1
  74. 2
  75. 0
  76.  
  77. 0
  78.  
  79. 0
  80. 1
  81. 0
  82. 1
  83. 1
  84. 2
  85. 0
  86.  
  87. 0
  88.  
  89. 1
  90. 0
  91. 0
  92. 17
  93. 0
  94. 0
  95. 1
  96. 1
  97. 4
  98. 5
  99. Adder
  100. 0
  101. 2
  102. 1
  103. 5
  104. 0
  105. 0
  106. 2
  107. 5
  108. start
  109. 0
  110.  
  111. 11
  112. 1
  113. 0
  114. 1
  115. 0
  116. 2
  117. 4
  118. done
  119. 0
  120.  
  121. 14
  122. 0
  123. 0
  124. 2
  125. 1
  126. 2
  127. 1
  128. x
  129. 0
  130.  
  131. 1
  132. 1
  133. 0
  134. 3
  135. 1
  136. 2
  137. 1
  138. y
  139. 0
  140.  
  141. 3
  142. 1
  143. 0
  144. 4
  145. 1
  146. 2
  147. 1
  148. z
  149. 0
  150.  
  151. 7
  152. 0
  153. 0
  154. 21
  155. 0
  156. 0
  157. 5
  158. 10
  159. Subtracter
  160. 0
  161. 2
  162. 1
  163. 5
  164. 0
  165. 0
  166. 2
  167. 5
  168. start
  169. 0
  170.  
  171. 11
  172. 1
  173. 0
  174. 1
  175. 0
  176. 2
  177. 4
  178. done
  179. 0
  180.  
  181. 14
  182. 0
  183. 0
  184. 2
  185. 1
  186. 2
  187. 1
  188. x
  189. 0
  190.  
  191. 1
  192. 1
  193. 0
  194. 3
  195. 1
  196. 2
  197. 1
  198. y
  199. 0
  200.  
  201. 3
  202. 1
  203. 0
  204. 4
  205. 1
  206. 2
  207. 1
  208. z
  209. 0
  210.  
  211. 7
  212. 0
  213. 0
  214. 21
  215. 0
  216. 0
  217. 6
  218. 10
  219. Multiplier
  220. 0
  221. 2
  222. 1
  223. 5
  224. 0
  225. 0
  226. 2
  227. 5
  228. start
  229. 0
  230.  
  231. 11
  232. 1
  233. 0
  234. 1
  235. 0
  236. 2
  237. 4
  238. done
  239. 0
  240.  
  241. 14
  242. 0
  243. 0
  244. 2
  245. 1
  246. 2
  247. 1
  248. x
  249. 0
  250.  
  251. 1
  252. 1
  253. 0
  254. 3
  255. 1
  256. 2
  257. 1
  258. y
  259. 0
  260.  
  261. 3
  262. 1
  263. 0
  264. 4
  265. 1
  266. 2
  267. 1
  268. z
  269. 0
  270.  
  271. 7
  272. 0
  273. 0
  274. 21
  275. 0
  276. 0
  277. 7
  278. 12
  279. Synchronizer
  280. 0
  281. 2
  282. 1
  283. 2
  284. 0
  285. 0
  286. 2
  287. 5
  288. ready
  289. 0
  290.  
  291. 11
  292. 1
  293. 0
  294. 1
  295. 0
  296. 2
  297. 12
  298. synchronized
  299. 0
  300.  
  301. 14
  302. 0
  303. 0
  304. 21
  305. 0
  306. 0
  307. 8
  308. 18
  309. Constant Generator
  310. 0
  311. 2
  312. 1
  313. 3
  314. 0
  315. 0
  316. 2
  317. 5
  318. start
  319. 0
  320.  
  321. 11
  322. 1
  323. 0
  324. 1
  325. 0
  326. 2
  327. 4
  328. done
  329. 0
  330.  
  331. 14
  332. 0
  333. 0
  334. 4
  335. 1
  336. 2
  337. 1
  338. z
  339. 0
  340.  
  341. 7
  342. 0
  343. 0
  344. 21
  345. 0
  346. 0
  347. 9
  348. 15
  349. Change Detector
  350. 0
  351. 2
  352. 1
  353. 4
  354. 0
  355. 0
  356. 2
  357. 5
  358. start
  359. 0
  360.  
  361. 11
  362. 1
  363. 0
  364. 1
  365. 0
  366. 2
  367. 4
  368. done
  369. 0
  370.  
  371. 14
  372. 0
  373. 0
  374. 2
  375. 1
  376. 2
  377. 1
  378. x
  379. 0
  380.  
  381. 2
  382. 1
  383. 0
  384. 4
  385. 1
  386. 2
  387. 1
  388. z
  389. 0
  390.  
  391. 7
  392. 0
  393. 0
  394. 21
  395. 0
  396. 0
  397. 10
  398. 6
  399. Holder
  400. 0
  401. 2
  402. 1
  403. 4
  404. 0
  405. 0
  406. 2
  407. 4
  408. pass
  409. 0
  410.  
  411. 11
  412. 1
  413. 0
  414. 2
  415. 0
  416. 2
  417. 4
  418. done
  419. 0
  420.  
  421. 14
  422. 0
  423. 0
  424. 3
  425. 1
  426. 2
  427. 1
  428. x
  429. 0
  430.  
  431. 2
  432. 1
  433. 0
  434. 4
  435. 1
  436. 2
  437. 1
  438. z
  439. 0
  440.  
  441. 7
  442. 0
  443. 0
  444. 21
  445. 0
  446. 0
  447. 11
  448. 8
  449. Splitter
  450. 0
  451. 2
  452. 1
  453. 7
  454. 0
  455. 0
  456. 2
  457. 5
  458. pass1
  459. 0
  460.  
  461. 10
  462. 1
  463. 0
  464. 1
  465. 0
  466. 2
  467. 5
  468. pass2
  469. 0
  470.  
  471. 12
  472. 1
  473. 0
  474. 2
  475. 0
  476. 2
  477. 5
  478. done1
  479. 0
  480.  
  481. 13
  482. 0
  483. 0
  484. 3
  485. 1
  486. 2
  487. 1
  488. x
  489. 0
  490.  
  491. 2
  492. 1
  493. 0
  494. 4
  495. 1
  496. 2
  497. 2
  498. z1
  499. 0
  500.  
  501. 6
  502. 0
  503. 0
  504. 5
  505. 1
  506. 2
  507. 2
  508. z2
  509. 0
  510.  
  511. 8
  512. 0
  513. 0
  514. 6
  515. 0
  516. 2
  517. 5
  518. done2
  519. 0
  520.  
  521. 15
  522. 0
  523. 0
  524. 21
  525. 0
  526. 0
  527. 12
  528. 6
  529. Merger
  530. 0
  531. 2
  532. 1
  533. 6
  534. 0
  535. 0
  536. 2
  537. 5
  538. pass1
  539. 0
  540.  
  541. 10
  542. 1
  543. 0
  544. 1
  545. 0
  546. 2
  547. 5
  548. pass2
  549. 0
  550.  
  551. 12
  552. 1
  553. 0
  554. 2
  555. 0
  556. 2
  557. 4
  558. done
  559. 0
  560.  
  561. 14
  562. 0
  563. 0
  564. 3
  565. 1
  566. 2
  567. 2
  568. x1
  569. 0
  570.  
  571. 1
  572. 1
  573. 0
  574. 4
  575. 1
  576. 2
  577. 2
  578. x2
  579. 0
  580.  
  581. 3
  582. 1
  583. 0
  584. 5
  585. 1
  586. 2
  587. 1
  588. z
  589. 0
  590.  
  591. 7
  592. 0
  593. 0
  594. 21
  595. 0
  596. 0
  597. 13
  598. 7
  599. Delayer
  600. 0
  601. 2
  602. 1
  603. 3
  604. 0
  605. 0
  606. 2
  607. 5
  608. start
  609. 0
  610.  
  611. 11
  612. 1
  613. 0
  614. 1
  615. 0
  616. 2
  617. 4
  618. done
  619. 0
  620.  
  621. 14
  622. 0
  623. 0
  624. 2
  625. 1
  626. 2
  627. 5
  628. delay
  629. 0
  630.  
  631. 2
  632. 1
  633. 0
  634. 21
  635. 0
  636. 0
  637. 14
  638. 6
  639. Tester
  640. 0
  641. 2
  642. 1
  643. 5
  644. 0
  645. 0
  646. 2
  647. 5
  648. start
  649. 0
  650.  
  651. 11
  652. 1
  653. 0
  654. 1
  655. 0
  656. 2
  657. 8
  658. positive
  659. 0
  660.  
  661. 13
  662. 0
  663. 0
  664. 2
  665. 0
  666. 2
  667. 4
  668. zero
  669. 0
  670.  
  671. 14
  672. 0
  673. 0
  674. 3
  675. 0
  676. 2
  677. 8
  678. negative
  679. 0
  680.  
  681. 15
  682. 0
  683. 0
  684. 4
  685. 1
  686. 2
  687. 1
  688. x
  689. 0
  690.  
  691. 2
  692. 1
  693. 0
  694. 21
  695. 0
  696. 0
  697. 15
  698. 13
  699. A/D Converter
  700. 0
  701. 2
  702. 1
  703. 3
  704. 0
  705. 0
  706. 2
  707. 5
  708. start
  709. 0
  710.  
  711. 11
  712. 1
  713. 0
  714. 1
  715. 0
  716. 2
  717. 4
  718. done
  719. 0
  720.  
  721. 14
  722. 0
  723. 0
  724. 2
  725. 1
  726. 2
  727. 6
  728. sample
  729. 0
  730.  
  731. 7
  732. 0
  733. 0
  734. 21
  735. 0
  736. 0
  737. 16
  738. 13
  739. D/A Converter
  740. 0
  741. 2
  742. 1
  743. 3
  744. 0
  745. 0
  746. 2
  747. 5
  748. start
  749. 0
  750.  
  751. 11
  752. 1
  753. 0
  754. 1
  755. 0
  756. 2
  757. 4
  758. done
  759. 0
  760.  
  761. 14
  762. 0
  763. 0
  764. 2
  765. 1
  766. 2
  767. 4
  768. data
  769. 0
  770.  
  771. 2
  772. 1
  773. 0
  774. 21
  775. 0
  776. 0
  777. 17
  778. 6
  779. Switch
  780. 0
  781. 2
  782. 1
  783. 3
  784. 0
  785. 0
  786. 2
  787. 2
  788. on
  789. 0
  790.  
  791. 10
  792. 1
  793. 0
  794. 1
  795. 0
  796. 2
  797. 3
  798. off
  799. 0
  800.  
  801. 12
  802. 1
  803. 0
  804. 2
  805. 0
  806. 2
  807. 4
  808. done
  809. 0
  810.  
  811. 14
  812. 0
  813. 0
  814. 21
  815. 0
  816. 0
  817. 18
  818. 7
  819. Starter
  820. 0
  821. 2
  822. 1
  823. 1
  824. 2
  825. 0
  826. 2
  827. 2
  828. go
  829. 0
  830.  
  831. 14
  832. 0
  833. 0
  834. 21
  835. 0
  836. 0
  837. 19
  838. 7
  839. Negater
  840. 0
  841. 2
  842. 1
  843. 4
  844. 0
  845. 0
  846. 2
  847. 5
  848. start
  849. 0
  850.  
  851. 11
  852. 1
  853. 0
  854. 1
  855. 0
  856. 2
  857. 4
  858. done
  859. 0
  860.  
  861. 14
  862. 0
  863. 0
  864. 2
  865. 1
  866. 2
  867. 1
  868. x
  869. 0
  870.  
  871. 2
  872. 1
  873. 0
  874. 3
  875. 1
  876. 2
  877. 1
  878. z
  879. 0
  880.  
  881. 7
  882. 0
  883. 0
  884. 21
  885. 0
  886. 0
  887. 20
  888. 15
  889. Absolute Valuer
  890. 0
  891. 2
  892. 1
  893. 4
  894. 0
  895. 0
  896. 2
  897. 5
  898. start
  899. 0
  900.  
  901. 11
  902. 1
  903. 0
  904. 1
  905. 0
  906. 2
  907. 4
  908. done
  909. 0
  910.  
  911. 14
  912. 0
  913. 0
  914. 2
  915. 1
  916. 2
  917. 1
  918. x
  919. 0
  920.  
  921. 2
  922. 1
  923. 0
  924. 3
  925. 1
  926. 2
  927. 1
  928. z
  929. 0
  930.  
  931. 7
  932. 0
  933. 0
  934. 21
  935. 0
  936. 0
  937. 21
  938. 7
  939. Limiter
  940. 0
  941. 2
  942. 1
  943. 5
  944. 0
  945. 0
  946. 2
  947. 5
  948. start
  949. 0
  950.  
  951. 11
  952. 1
  953. 0
  954. 1
  955. 0
  956. 2
  957. 4
  958. done
  959. 0
  960.  
  961. 14
  962. 0
  963. 0
  964. 2
  965. 1
  966. 2
  967. 1
  968. x
  969. 0
  970.  
  971. 1
  972. 1
  973. 0
  974. 3
  975. 1
  976. 2
  977. 3
  978. max
  979. 0
  980.  
  981. 3
  982. 1
  983. 0
  984. 4
  985. 1
  986. 2
  987. 1
  988. z
  989. 0
  990.  
  991. 7
  992. 0
  993. 0
  994. 21
  995. 0
  996. 0
  997. 10485
  998.       
  999. 25
  1000. 0
  1001. 5
  1002. Boxes
  1003. 18
  1004. 4
  1005. 5
  1006. 6
  1007. 7
  1008. 8
  1009. 9
  1010. 10
  1011. 11
  1012. 12
  1013. 13
  1014. 14
  1015. 15
  1016. 16
  1017. 17
  1018. 18
  1019. 19
  1020. 20
  1021. 21
  1022. 1
  1023. 5
  1024. Links
  1025. 2
  1026. 2
  1027. 3
  1028. 2
  1029. 5
  1030. Ports
  1031. 2
  1032. 0
  1033. 1
  1034. 3
  1035. 6
  1036. Master
  1037. 22
  1038. 0
  1039. 1
  1040. 2
  1041. 3
  1042. 4
  1043. 5
  1044. 6
  1045. 7
  1046. 8
  1047. 9
  1048. 10
  1049. 11
  1050. 12
  1051. 13
  1052. 14
  1053. 15
  1054. 16
  1055. 17
  1056. 18
  1057. 19
  1058. 20
  1059. 21
  1060. 4
  1061. 5
  1062. Boxes
  1063. 0
  1064. 5
  1065. 5
  1066. Links
  1067. 0
  1068. 6
  1069. 5
  1070. Ports
  1071. 0
  1072. 7
  1073. 6
  1074. Master
  1075. 0
  1076. 8
  1077. 5
  1078. Boxes
  1079. 0
  1080. 9
  1081. 5
  1082. Links
  1083. 0
  1084. 10
  1085. 5
  1086. Ports
  1087. 0
  1088. 11
  1089. 6
  1090. Master
  1091. 0
  1092. 12
  1093. 5
  1094. Boxes
  1095. 0
  1096. 13
  1097. 5
  1098. Links
  1099. 0
  1100. 14
  1101. 5
  1102. Ports
  1103. 0
  1104. 15
  1105. 6
  1106. Master
  1107. 0
  1108. 16
  1109. 5
  1110. Boxes
  1111. 0
  1112. 17
  1113. 5
  1114. Links
  1115. 0
  1116. 18
  1117. 5
  1118. Ports
  1119. 0
  1120. 19
  1121. 6
  1122. Master
  1123. 0
  1124. 20
  1125. 22
  1126. Primitives (Built-ins)
  1127. 4
  1128. 0
  1129. 1
  1130. 2
  1131. 3
  1132. 21
  1133. 27
  1134. Boxes: Arithmetic Operators
  1135. 8
  1136. 4
  1137. 5
  1138. 6
  1139. 8
  1140. 14
  1141. 19
  1142. 20
  1143. 21
  1144. 22
  1145. 21
  1146. Boxes: State Machines
  1147. 5
  1148. 7
  1149. 9
  1150. 10
  1151. 13
  1152. 18
  1153. 23
  1154. 17
  1155. Boxes: Interfaces
  1156. 3
  1157. 15
  1158. 16
  1159. 17
  1160. 24
  1161. 17
  1162. Boxes: Connectors
  1163. 2
  1164. 11
  1165. 12
  1166. 9
  1167. 0
  1168. 1
  1169. 1
  1170. 1
  1171. 2
  1172. 1
  1173. 9
  1174. 0
  1175. 1
  1176. 2
  1177. 3
  1178. 20
  1179. 21
  1180. 22
  1181. 23
  1182. 24
  1183. 0
  1184. 1
  1185. 2
  1186. 3
  1187. 3
  1188. 1
  1189. 4
  1190. 4
  1191. 5
  1192. 6
  1193. 7
  1194. 4
  1195. 5
  1196. 6
  1197. 7
  1198. 4
  1199. 1
  1200. 4
  1201. 8
  1202. 9
  1203. 10
  1204. 11
  1205. 8
  1206. 9
  1207. 10
  1208. 11
  1209. 5
  1210. 0
  1211. 6
  1212. 0
  1213. 4
  1214. 12
  1215. 13
  1216. 14
  1217. 15
  1218. 12
  1219. 13
  1220. 14
  1221. 15
  1222. 7
  1223. 0
  1224. 8
  1225. 0
  1226. 4
  1227. 16
  1228. 17
  1229. 18
  1230. 19
  1231. 16
  1232. 17
  1233. 18
  1234. 19
  1235. 667
  1236. This port is a connection point for a control link.
  1237.  
  1238. An output control port is ordinarily quiescent.  When “poked” by a box it is on, however, it emits an infinitesimally short control “pulse” that can be transmitted instantaneously to other (input) control ports via a control link.
  1239.  
  1240. An input control port “listens” for control pulses and notifies the box it is on that such a pulse has been received.  It acts exactly like a flip-flop whose value is set to “one” by a received control pulse, and whose value is reset to “zero” by the box it is on.  The action of the box in response to a pulse on a particular input control port depends on its function, of course.
  1241.  
  1242. 61
  1243. This is a primitive part in the “Concurrent” interpretation.
  1244.  
  1245. 633
  1246. This port is a connection point for a data link.
  1247.  
  1248. An output data port is ordinarily quiescent.  When “written to” by a box it is on, however, it emits for an infinitesimally short time a data value that can be transmitted instantaneously to other (input) data ports via a data link.
  1249.  
  1250. An input data port “listens” for data values and remembers the data value when it receives one.  It acts exactly like a register whose value is set whenever a data value is received.  (The new value overwrites any previous value that may have been in this register.)  The box it is on may “read” the data value from any input data port at any time.
  1251.  
  1252. 61
  1253. This is a primitive part in the “Concurrent” interpretation.
  1254.  
  1255. 166
  1256. This link transmits a control “pulse” instantaneously from any output control port connected to its left end, to every input control port connected to its right end.
  1257.  
  1258. 61
  1259. This is a primitive part in the “Concurrent” interpretation.
  1260.  
  1261. 155
  1262. This link transmits a data value instantaneously from any output data port connected to its left end, to every input data port connected to its right end.
  1263.  
  1264. 61
  1265. This is a primitive part in the “Concurrent” interpretation.
  1266.  
  1267. 107
  1268. When “start” is poked, values are read from “x” and “y”, their sum is written to “z”, and “done” is poked.
  1269.  
  1270. 60
  1271. start:
  1272. {
  1273.   write (z, read (x) + read (y));
  1274.   poke (done);
  1275. }
  1276.  
  1277. 0
  1278.  
  1279. 120
  1280. When “start” is poked, values are read from “x” and “y”, their difference (x-y) is written to “z”, and “done” is poked.
  1281.  
  1282. 60
  1283. start:
  1284. {
  1285.   write (z, read (x) - read (y));
  1286.   poke (done);
  1287. }
  1288.  
  1289. 0
  1290.  
  1291. 111
  1292. When “start” is poked, values are read from “x” and “y”, their product is written to “z”, and “done” is poked.
  1293.  
  1294. 60
  1295. start:
  1296. {
  1297.   write (z, read (x) * read (y));
  1298.   poke (done);
  1299. }
  1300.  
  1301. 0
  1302.  
  1303. 291
  1304. Initially, the state of this box is such that it thinks none of the control links attached to “ready” has been poked yet.
  1305.  
  1306. Exactly when all control links attached to “ready” have been poked at least once, “synchronized” is poked, and the state of this box is reset to its initial condition.
  1307.  
  1308. 576
  1309. boolean *poked;
  1310. int number_poked;
  1311. int number_needed = size (ready);
  1312.  
  1313. /*------------------------------------*/
  1314.  
  1315. void reset ()
  1316. {
  1317.   int i;
  1318.   for (i = number_needed - 1; i >= 0; i--) poked [i] = FALSE;
  1319.   number_poked = 0;
  1320. }
  1321.  
  1322. /*------------------------------------*/
  1323.  
  1324. init:
  1325. {
  1326.   poked = (boolean *) malloc (sizeof (boolean) * number_needed);
  1327.   reset ();
  1328. }
  1329.  
  1330. /*------------------------------------*/
  1331.  
  1332. ready (k):
  1333. {
  1334.   if (! poked [k])
  1335.     {
  1336.       poked [k] = TRUE;
  1337.       if (++number_poked == number_needed)
  1338.         {
  1339.           poke (synchronized);
  1340.           reset ();
  1341.         }
  1342.     }
  1343. }
  1344. 0
  1345.  
  1346. 108
  1347. When “start” is poked, the value of this box’s instance information is written to “z”, and “done” is poked.
  1348.  
  1349. 64
  1350. start:
  1351. {
  1352.   write (z, instance_information ());
  1353.   poke (done);
  1354. }
  1355.  
  1356. 0
  1357.  
  1358. 302
  1359. Initially, the value of this box’s instance information is written to “z” and “done” is poked.
  1360.  
  1361. When “start” is poked, the value is read from “x” and compared to the last value written to “z”.  If and only if they are different, the new value just read from “x” is written to “z”, and “done” is poked.
  1362.  
  1363. 423
  1364. real last_value;
  1365.  
  1366. /*------------------------------------*/
  1367.  
  1368. void write_value ()
  1369. {
  1370.   write (z, last_value);
  1371.   poke (done);
  1372. }
  1373.  
  1374. /*------------------------------------*/
  1375.  
  1376. init:
  1377. {
  1378.   last_value = instance_information;
  1379.   write_value ();
  1380. }
  1381.  
  1382. /*------------------------------------*/
  1383.  
  1384. start:
  1385. {
  1386.   real new_value;
  1387.   new_value = read (x);
  1388.   if (new_value != last_value)
  1389.     {
  1390.       last_value = new_value;
  1391.       write_value ();
  1392.     }
  1393. }
  1394.  
  1395. 0
  1396.  
  1397. 91
  1398. When “pass” is poked, a value is read from “x”, it is written to “z”, and “done” is poked.
  1399.  
  1400. 48
  1401. pass:
  1402. {
  1403.   write (z, read (x));
  1404.   poke (done);
  1405. }
  1406.  
  1407. 0
  1408.  
  1409. 193
  1410. • When “pass1” is poked, the value of “x” is read, it is written to “z1”, and “done1” is poked.
  1411.  
  1412. • When “pass2” is poked, the value of “x” is read, it is written to “z2”, and “done2” is poked.
  1413.  
  1414. 145
  1415. pass1:
  1416. {
  1417.   write (z1, read (x));
  1418.   poke (done1);
  1419. }
  1420.  
  1421. /*------------------------------------*/
  1422.  
  1423. pass2:
  1424. {
  1425.   write (z2, read (x));
  1426.   poke (done2);
  1427. }
  1428.  
  1429. 0
  1430.  
  1431. 191
  1432. • When “pass1” is poked, the value of “x1” is read, it is written to “z”, and “done” is poked.
  1433.  
  1434. • When “pass2” is poked, the value of “x2” is read, it is written to “z”, and “done” is poked.
  1435.  
  1436. 143
  1437. pass1:
  1438. {
  1439.   write (z, read (x1));
  1440.   poke (done);
  1441. }
  1442.  
  1443. /*------------------------------------*/
  1444.  
  1445. pass2:
  1446. {
  1447.   write (z, read (x2));
  1448.   poke (done);
  1449. }
  1450.  
  1451. 0
  1452.  
  1453. 105
  1454. When “start” is poked, this box reads “delay” and waits that number of clock ticks before poking “done”.
  1455.  
  1456. 49
  1457. start:
  1458. {
  1459.   hold (read (delay));
  1460.   poke (done);
  1461. }
  1462.  
  1463. 0
  1464.  
  1465. 136
  1466. When “start” is poked:
  1467. • If “x” > 0 then “positive” is poked.
  1468. • If “x” = 0 then “zero” is poked.
  1469. • If “x” < 0 then “negative” is poked.
  1470.  
  1471. 133
  1472. start:
  1473. {
  1474.   real xx;
  1475.      xx = read (x);
  1476.   if (xx > 0) poke (positive);
  1477.     else if (xx == 0) poke (zero);
  1478.       else poke (negative);
  1479. }
  1480.  
  1481. 0
  1482.  
  1483. 168
  1484. When “start” is poked, a value obtained from an A/D converter (whose identity is in the instance information for this box) is written to “sample”, and “done” is poked.
  1485.  
  1486. 78
  1487. start:
  1488. {
  1489.   write (sample, A_to_D (instance_information ()));
  1490.   poke (done);
  1491. }
  1492.  
  1493. 0
  1494.  
  1495. 167
  1496. When “start” is poked, a value is read from “data” and is output to a D/A converter (whose identity is in the instance information for this box), and “done” is poked.
  1497.  
  1498. 75
  1499. start:
  1500. {
  1501.   D_to_A (instance_information (), read (data));
  1502.   poke (done);
  1503. }
  1504.  
  1505. 0
  1506.  
  1507. 208
  1508. When “on” is poked, a physical switch (whose identity is given by the instance information of this box) is turned on, and “done” is poked.  When “off” is poked, the switch is turned off, and “done” is poked.
  1509.  
  1510. 183
  1511. on:
  1512. {
  1513.   set_switch (instance_information (), TRUE);
  1514.   poke (done);
  1515. }
  1516.  
  1517. /*------------------------------------*/
  1518.  
  1519. off:
  1520. {
  1521.   set_switch (instance_information (), FALSE);
  1522.   poke (done);
  1523. }
  1524.  
  1525. 0
  1526.  
  1527. 86
  1528. Upon completion of system initialization, “go” is poked.  This box does nothing else.
  1529.  
  1530. 23
  1531. init:
  1532. {
  1533.   poke (go);
  1534. }
  1535.  
  1536. 0
  1537.  
  1538. 107
  1539. When “start” is poked, a value is read from “x”, its negation (-x) is written to “z”, and “done” is poked.
  1540.  
  1541. 50
  1542. start:
  1543. {
  1544.   write (z, -read (x));
  1545.   poke (done);
  1546. }
  1547.  
  1548. 0
  1549.  
  1550. 114
  1551. When “start” is poked, a value is read from “x”, its absolute value (|x|) is written to “z”, and “done” is poked.
  1552.  
  1553. 101
  1554. start:
  1555. {
  1556.   real abs;
  1557.   abs = read (x);
  1558.   if (abs < 0) abs = -abs;
  1559.   write (z, abs);
  1560.   poke (done);
  1561. }
  1562.  
  1563. 0
  1564.  
  1565. 180
  1566. When “start” is poked, values are read from “x” and “max”.  Then one of the following values is written to “z”:
  1567.  
  1568. • if x < max, then x
  1569.  
  1570. • if x ≥ max, then max
  1571.  
  1572. and “done” is poked.
  1573.  
  1574. 181
  1575. start:
  1576. {
  1577.   real input, high, output;
  1578.   input = read (x);
  1579.   high = read (max);
  1580.   if (input > high) then output = high;
  1581.     else output = input;
  1582.   write (z, output);
  1583.   poke (done);
  1584. }
  1585.  
  1586. 0
  1587.  
  1588. 0
  1589. 3125
  1590. 3797
  1591. 3797
  1592. 1
  1593. 3862
  1594. 4500
  1595. 4500
  1596. 2
  1597. 4565
  1598. 4736
  1599. 4736
  1600. 3
  1601. 4801
  1602. 4961
  1603. 4961
  1604. 4
  1605. 5026
  1606. 5138
  1607. 5202
  1608. 5
  1609. 5205
  1610. 5330
  1611. 5394
  1612. 6
  1613. 5397
  1614. 5513
  1615. 5577
  1616. 7
  1617. 5580
  1618. 5876
  1619. 6457
  1620. 8
  1621. 6460
  1622. 6573
  1623. 6641
  1624. 9
  1625. 6644
  1626. 6951
  1627. 7379
  1628. 10
  1629. 7382
  1630. 7477
  1631. 7529
  1632. 11
  1633. 7532
  1634. 7730
  1635. 7880
  1636. 12
  1637. 7883
  1638. 8079
  1639. 8227
  1640. 13
  1641. 8230
  1642. 8340
  1643. 8393
  1644. 14
  1645. 8396
  1646. 8537
  1647. 8675
  1648. 15
  1649. 8678
  1650. 8851
  1651. 8933
  1652. 16
  1653. 8936
  1654. 9108
  1655. 9187
  1656. 17
  1657. 9190
  1658. 9403
  1659. 9591
  1660. 18
  1661. 9594
  1662. 9684
  1663. 9711
  1664. 19
  1665. 9714
  1666. 9826
  1667. 9880
  1668. 20
  1669. 9883
  1670. 10002
  1671. 10108
  1672. 21
  1673. 10111
  1674. 10296
  1675. 10482
  1676.